<?php
namespace app\v1\controller;

use think\Controller;
use think\Loader;

class Token extends Controller
{
    public function index()
    {
        
    	$postData = input('get.');

    	$validate = Loader::validate('Token');

		if(!$validate->check($postData)){

		    return json(['code'=>10001,'msg'=>$validate->getError()]);
		}

		if(true){

			cache('token',md5(123456));

			return json(['code'=>0,'token'=>md5(123456)]);

		}else{

			return json(['code'=>10002,'msg'=>'没有权限！！！！！,请先开通']);
		}
        
    }
}
